// pages/information-show/index.js
var util = require('../../utils/util.js');
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    info:'',
    intentTime:0,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    util.post(app.api.getByUnionid,{unionid:app.globalData.unionid},(res)=>{
      console.log(res)
      if(res.intentTime==0){
        this.setData({
          intentTime:'现在'
        })
      }else if(res.intentTime==1){
        this.setData({
          intentTime:'一月后',
        })
      }else if(res.intentTime==2){
        this.setData({
          intentTime:'半年后'
        })
      }else{
        this.setData({
          intentTime:'一年后'
        })
      }
      this.setData({
        info:res
      })
    })
  },
  goNextPage: function(){
    wx.navigateTo({
      url: '/pages/information/index',
      // url:'/pages/essentialInfo/index',
    })
  },
  //分享
  onShareAppMessage: function (res) {
    var that = this
    if (res.from === 'button') {
      // 来自页面内转发按钮
    }
    var title = that.data.positionInfo.companyName + ' 招聘 ' + that.data.positionInfo.name
    return {
      // title: title,
      // path: 'pages/position-detail/position-detail?pid=' + that.data.positionInfo.id,
      // data: that.data.positionInfo,
      // imageUrl: this.data.imgUrl,
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      },
    }
  },
  onShareTimeline: function (res) {
    var title = that.data.positionInfo.companyName + ' 招聘 ' + that.data.positionInfo.name
    return {
      title: title,
      query: 'pid=' + that.data.positionInfo.id,
    }
  },
})